﻿package net.imonair.core.events {
	import flash.events.Event;
	import net.imonair.core.contacts.IMContactList;
	import net.imonair.core.contacts.IIMContact;
	public class IMContactListEvent extends Event {
		public static const ADDED			:String = "contactAdded";
		public static const REMOVED			:String = "contactRemoved";
		public static const SYNCED			:String = "contactListSynced";
		public static const GROUP_ADDED		:String = "groupAdded";
		public static const GROUP_RENAMED	:String = "groupRenamed";
		public static const GROUP_REMOVED	:String = "groupRemoved";
		public static const GROUPS_READY	:String = "groupsReady";
		protected var _relatedContactList:IMContactList;
		protected var _relatedContact:IIMContact;
		public function IMContactListEvent(type:String, relatedContactList:IMContactList, relatedContact:IIMContact = null) {
			super(type, false, false);
			this._relatedContactList = relatedContactList;
			this._relatedContact = relatedContact;
		}
		public function get relatedContact():IIMContact {
			return this._relatedContact;
		}
		override public function get target():Object {
			return this._relatedContactList;
		}
		override public function clone():Event {
			return new IMContactListEvent(this.type, this._relatedContactList, this._relatedContact);
		}
		override public function toString():String {
			return formatToString("IMContactListEvent", "type", "bubbles", "cancelable", "relatedContact", "eventPhase");
		}
	}
}